package main

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

func main() {
	//初始化引擎实例
	router:=gin.Default()
	//路由1
	//匹配/user/zhangsan 不匹配/user/zhangsan/user
	router.GET("/user/:name", func(context *gin.Context) {
		name:=context.Param("name")
		context.String(http.StatusOK,"you name is "+name)
	})
	//路由2
	router.GET("/user/:name/*action", func(c *gin.Context) {
		name := c.Param("name")
		action := c.Param("action")
		message := name + " is " + action
		c.String(http.StatusOK, message)
	})
	router.Run()
}
